<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="domain.entity.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path;
	ServletContext context = pageContext.getServletContext();
	SysRole role = (SysRole) context.getAttribute("role");
	String id = (String) context.getAttribute("id");
	String groupid = (String) context.getAttribute("groupid");
%>
<div style="width: 100%">
    <table style="width: 100%;line-height: 24px" class="form-table">
        <tr>
            <td class="form-label" style="width: 10%;">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称<span style=" color: red">*</span>:</td>
            <td>
                <input class="easyui-textbox" name="txtaccount" id="txtrolename" value="<%=role.getName() %>" type="text">
            </td>
        </tr>
        <tr>
            <td class="form-label" style="width: 10%;">分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;组<span style=" color: red">*</span>:</td>
            <td>
            <select id="selrolegourp" style="width:150px">
            </select>
            </td>
        </tr>
        <tr>
            <td class="form-label"></td>
            <td class="form-label"></td>
            <td>
                <div id="divpower">
                    <a href="javascript:saveroleData()" class="easyui-linkbutton" style=" width:80px" id="btnSave">保存</a>
                </div>
            </td>
        </tr>

    </table>
</div>

<script type="text/javascript">
    $(function () {
    	$('#selrolegourp').combobox({
    		    url:'<%=basePath%>/system/dropdownData/getRoleGroup?type=all',    
    		    valueField:'value',    
    		    textField:'text',
    		    onLoadSuccess:function(){
    		    	 $("#selrolegourp").combobox('setValue','<%=groupid%>');
    		    }
    	})
       
    })
    function saveroleData() {
        if ($("#txtrolename").val().trim() == "") {
            ERP_alert("名称不能为空!");
            return;
        }
        var postdata = {
            id:'<%=(id==null?"":id)%>',
            name: $("#txtrolename").val().trim(),
            group: $("#selrolegourp").combobox('getValue'),
        };

        $.post("<%=basePath%>/system/role/saveRole", postdata, function (data) {
            rolequery();
            $('#storedetail').dialog('close');
        });
    }
</script>




